import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.*; 
import javax.swing.filechooser.FileNameExtensionFilter;


public class Reading extends JPanel {

		//Reference to canvas
		Canvas myCanvas;
		String[] numStrings = {"0","1","2","3","4","5","6"};
		final JComboBox buttonnum = new JComboBox(numStrings);
		
		public Reading(Canvas aCanvas){
			myCanvas = aCanvas;
			setBackground(Color.white);
		}
	
		
		public void init(){
			
			//top selection
			JLabel label = new JLabel("Number of Button(s)");
			add(label);
			
			buttonnum.setSelectedIndex(0);
			add(buttonnum);
			
			JButton generate = new JButton("Update");
			generate.addActionListener(new ActionListener() {
		         
				@Override
				public void actionPerformed(ActionEvent arg0) {
					int numB = Integer.parseInt((String)(buttonnum.getSelectedItem()));
					int space = myCanvas.getWidth() / (numB + 1);
					myCanvas.drawButtons(numB,space);
				}
		       });
			add(generate);
			
		}
		
		public void reset(){
			buttonnum.setSelectedIndex(0);
		}
		
		
}
